{template 'member','header'}
<script type="text/javascript" src="images/js/validator.js"></script>
<div id="main">
      {if $step == 1}
    	<form action="{$M[url]}getpwd.php?action=getpwd" method="post" name="getpwd" id="getpwd">
        	<table cellpadding="0" cellspacing="0" class="table_form">
      			<caption>
      			请输入用户名和注册邮箱
      			</caption>
   			 <tr>
     			<th width="12%">用户名：</th>
    			<td width="21%"><input name="username" type="text" id="username" value="" size="20"></td>
    			<td width="67%"></td>
  			 </tr>
             <tr>
             	<th>注册邮箱:</th>
             	<td><input name="email" type="text" id="email" value="" size="20"></td>
				<td></td>
             </tr>
             <tr>
        		<th></th>
                <td colspan="2">
				<label>
					<input type="hidden" name="forward" value="{$forward}"> 
					<input type="hidden" name="step" value="{$step}" />
					<input type="submit" name="dosubmit" id="button" value="下一步" />　
					<input type="reset" name="button2" id="button2" value="重 置" />
				</label>
				</td>
       		 </tr>
            </table>
        </form>
      {/if}
      {if $step == 2}
      	<form action="{$M[url]}getpwd.php?action=getpwd" method="post" name="getpwd" id="getpwd">
        	<table cellpadding="0" cellspacing="0" class="table_form">
            <caption>
      			请输入密码提示的答案
      			</caption>
				<tr>
					<input type="hidden" name="question" value="{$question}" />
                	<th width="12%">密码提示问题：</th>
                    <td width="21%">
					{$question}
                    </td>
                    <td width="67%"></td>
                </tr>
                <tr>
                	<th>问题答案：</th>
                    <td>
                    	<input name="answer" type="text" id="answer" />
                    </td>					
					<td></td>
                </tr>
                <tr>
                	<th></th>
                    <td colspan="2">
                    <input type="hidden" name="userid" value="{$userid}" />
					<input type="hidden" name="username" value="{$username}" />
                    <input type="hidden" name="step" value="3" />
					<input type="hidden" name="dosubmit" value="1" />
                    	<label>
                        	<input type="submit" name="dosubmit" id="dosubmit" value="下一步" />
							<input type="reset" name="reset" value="重置" />
                    	</label>
                    </td>
                </tr>
            </table>
        </form>
      {/if}
      {if $step == 4}
      	<form action="{$M[url]}getpwd.php?action=getpwd" method="post" name="getpwd" id="getpwd">
        	<table cellpadding="0" cellspacing="0" class="table_form">
				<caption>修改密码</caption>
				{if $PHPCMS[uc]}
				<tr>
					<th width="12%">用户名：</th>
                    <td width="21%">
                    	<input type="text" name="name" id="name" require="true" datatype="limit" min="3" max="20" msg="用户名长度必须大于3小于20" />
                    </td>
				</tr>
				<tr>
					<th width="12%">邮件：</th>
                    <td width="21%">
                    	<input type="text" name="email" id="email"  />
                    </td>
				</tr>
				{/if}
				<tr>
                	<th width="12%">新密码：</th>
                    <td width="21%">
                    	<input type="password" name="password" id="password" require="true" datatype="limit" min="3" max="20" msg="密码长度必须大于3小于20" />
                    </td>
                </tr>
				
                <tr>
                	<th>密码强度：</th>
                    <td>
                    	 <div id="pw_check_1" class="pw_check" style="display:none;"><span><strong class="c_orange">弱</strong></span><span>中</span><span>强</span></div>
						<div id="pw_check_2" class="pw_check" style="display:none;"><span>弱</span><span><strong class="c_orange">中</strong></span><span>强</span></div>
							<div id="pw_check_3" class="pw_check" style="display:none;"><span>弱</span><span>中</span><span><strong class="c_orange">强</strong></span></div></td>
                    </td>
                </tr>
                <tr>
                	<th>确认密码：</th>
                    <td>
                    	<input type="password" id="pwdconfirm" name="pwdconfirm" require="true" datatype="repeat"  to="password" msg="两次输入的密码不一致" />
                    </td>
                </tr>
                <tr>
                <th></th>
                <td colspan="2">
				<input type="hidden" name="authstr" value="{$authstr}" />
                <input type="hidden" name="userid" value="{$userid}" />
                <input type="hidden" name="step" value="{$step}" />
                    <label>
                       	<input type="submit" name="dosubmit" id="button" value="下一步" />
                    </label>
                 </td>
              </tr>
            </table>
        </form>
      {/if}
	</div>
{template 'member','footer'}
<script language="javascript">
$().ready(function() {
	  $('form').checkForm(1);
	});

$('#password').blur(function(){
	ShowStrong();
 });

function CharMode(iN)
{
if (iN>=65 && iN <= 90)
return 2;
if (iN>=97 && iN <= 122)
return 4;
else
return 1;
}

function bitTotal(num)
{
modes = 0;
for(i=0; i<3; i++)
{
if (num & 1) modes++;
num >>>= 1;
}
return modes;
}

function checkStrong(sPW){
Modes=0;

for (i=0;i<sPW.length;i++){
//测试每一个字符的类别并统计一共有多少种模式.
Modes|=CharMode(sPW.charCodeAt(i));
}
var btotal = bitTotal(Modes);
if (sPW.length >= 10) btotal++;
switch(btotal) {
case 1:
return "pw_check_1";
break;
case 2:
return "pw_check_2";
break;
case 3:
return "pw_check_3";
break;
default:
return "pw_check_1";
}
}

function ShowStrong(){
data = checkStrong($('#password').val());
pw_id = '#' + data;
$(".pw_check").hide();
$(pw_id).show();
}

</script>